<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 * author Hieu Ho
 */
class Becometutor_model extends CI_Model {

    //put your code here
    public function __construct() {
        parent::__construct();
        $this->load->database();  
    }
    public function add_lamgiasu($id) {
        $this->db->select('thanhvien_id');
        $this->db->where('thanhvien_id',$id);
        $lamgiasu=$this->db->get('gs7s_lamgiasu');
        $monhoc = '';
        foreach ($this->input->post('monhoc') as $tungmonhoc)
        {
            $monhoc = $monhoc .' '. $tungmonhoc; 
        }
//        print_r($monhoc);
        $data = array(
            'thanhvien_id' => $id,
            'LamGiaSu_TrangThai_id' => '1',
            'NamSinh' => $this->input->post('NamSinh'),
            'NoiSinh' => $this->input->post('NoiSinh'),
//            'DiaChi' => $this->input->post('DiaChi'),
            'TrinhDo_id' => $this->input->post('TrinhDo'),
            'HocTruong' => $this->input->post('HocTruong'),
            'ChuyenNganh' => $this->input->post('ChuyenNganh'),
            'NamTotNghiep' => $this->input->post('NamTotNghiep'),            
            'HienLa' => $this->input->post('HienLa'),
            'KhoiLopDay' => $this->input->post('KhoiLopDay'),
            'KhuVucDay' => $this->input->post('KhuVucDay'),
            'ThoiGianDay' => $this->input->post('ThoiGianDay'),
            'SoBuoiDay' =>  $this->input->post('SoBuoiDay'),
            'MucLuongYeuCau' => $this->input->post('MucLuongYeuCau'),
            'MonHoc' => $monhoc,
        );
//        if($lamgiasu->num_rows == 0)
            $this->db->insert('gs7s_lamgiasu', $data);
//        else {
//            $this->db->where('thanhvien_id',$id);
//            $this->db->update ('gs7s_lamgiasu', $data);
//        }
    }

}
?>
